package com.xuyiwei.xblog.modular.article.warpper;

import com.xuyiwei.xblog.core.base.warpper.BaseControllerWarpper;
import com.xuyiwei.xblog.core.common.constant.factory.ConstantFactory;
import com.xuyiwei.xblog.core.util.ToolUtil;

import java.util.Map;

/**
 * Created by xuyiwei on 2018/10/16.
 */
public class TypeWarpper extends BaseControllerWarpper {


    public TypeWarpper(Object obj) {
        super(obj);
    }

    @Override
    protected void warpTheMap(Map<String, Object> map) {
        Long pid = (Long) map.get("pid");

        if (ToolUtil.isEmpty(pid) || pid.equals(0)) {
            map.put("pName", "--");
        } else {
            map.put("pName", ConstantFactory.me().getArticleTypeName(pid));
        }
    }
}
